import { json } from 'stream/consumers';
import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 代理关系
 */
@Entity('agent_relation')
export class AgentRelationEntity extends BaseEntity {
  // @Index()
  // @Column({ comment: '代理关系ID' })
  // agentRelationId: number;

  @Index()
  @Column({ comment: '上级代理ID', nullable: false })
  parentAgentId: number;

  @Index()
  @Column({ comment: '总代理ID', nullable: true })
  topAgentId: number;

  @Column({ comment: '代理层级', default: 0 })
  level: number;

  @Column({ comment: '备注', nullable: true })
  remark: string;

  @Column({ comment: '代理商ID', nullable: false })
  agentUserId: number;

  @Column({
    comment: '代理商店铺',
    type: 'json',
    nullable: true,
  })
  agentShopIds: { ids: number[] };

  @Column({
    comment: '代理关系字典',
    type: 'json',
    nullable: true,
  })
  agentRelationDict: Array<{}>;

  @Column({ comment: '序号', nullable: true })
  orderNum: number;

  // @Column({ comment: '状态', dict: ['禁用', '启用'], default: 1 })
  // status: number;
}